package domain.valueObejcts;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class Employee implements Serializable {

	private static final long serialVersionUID = 1L;
	// Constants for type
	public final static int TYPE_BARKEEPER = 10;
	public final static int TYPE_DJ = 11;
	public final static int TYPE_JUMPER = 12;
	public final static int TYPE_FACILITY = 13;
	public final static int TYPE_CASSIER = 14;

	// Constants for working conditions
	public final static int WC_BILLING = 20;
	public final static int WC_FOUR_HUNDRET = 21;
	public final static int WC_EMPLOYED = 22;
	
	public static final int ADD = 30;
	public static final int EDIT = 31;
	
	public static final String SUPERVISIOR = "Aufsicht";

	// Attributes
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
	private String forName;
	private String surName;
	private int type;
	private boolean smoker;
	private int workCondition;
	private String comments;

	public Employee(){
		
	}
	
	public Employee(String forName, String surName, int type, boolean smoker, int workCondition, String comments){
		this.forName = forName;
		this.surName = surName;
		this.type = type;
		this.smoker = smoker;
		this.workCondition = workCondition;
		this.comments = comments;
	}
	
	public int getId(){
		return this.id;
	}
	
	public void setId(int id){
		this.id = id;
	}
	
	public int getWorkCondition() {
		return workCondition;
	}

	public void setWorkCondition(int workCondition) {
		this.workCondition = workCondition;
	}

	public boolean isSmoker() {
		return smoker;
	}

	public void setSmoker(boolean smoker) {
		this.smoker = smoker;
	}

	public String getForName() {
		return forName;
	}

	public void setForName(String forName) {
		this.forName = forName;
	}

	public String getSurName() {
		return surName;
	}

	public void setSurName(String surName) {
		this.surName = surName;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public void setComments(String comments){
		this.comments = comments;
	}

	public String getComments() {
		return this.comments;
	}

	@Override
	public String toString() {
		return this.forName + ", " + this.surName.charAt(0);
	}

	@Override
	public boolean equals(Object obj) throws ClassCastException{
		if(obj == null) return false;
		if(obj instanceof Employee){
			if(((Employee)obj).getId() == this.id){
				return true;
			}
			return false;
		} else {
			throw new ClassCastException();
		}
	}

}
